import { defineConfig } from 'vite'
const path = require('path')
import vue from '@vitejs/plugin-vue'
import styleImport from 'vite-plugin-style-import'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    styleImport({
      libs: [{
        libraryName: 'element-plus',
        esModule: true,
        ensureStyleFile: true,
        resolveStyle: (name) => {
          name = name.slice(3)
          return `element-plus/packages/theme-chalk/src/${name}.scss`;
        },
        resolveComponent: (name) => {
          return `element-plus/lib/${name}`;
        },
      }]
    })
  ],
  base:'./',
  resolve:{
    alias:{
      '@':path.resolve(__dirname,'src')
    }
  },
  css:{
   preprocessorOptions:{
     scss:{
      additionalData:`@import "./src/styles/variables.scss";`
     }
   }
  },
  server: {
    // 是否开启 https
    https: false,
    /**
     * 端口号
     * @default 3000
     */
    port: 3000,
  },
  
})
